Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improving feature util test coverage #104

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

drduhe
Copy link
Collaborator

@drduhe drduhe commented Oct 21, 2024

Issue #, if available: n/a

Notes

This PR improves the robustness of the features_to_image_shapes function by allowing it to handle mixed valid and invalid features without terminating. Additionally, it expands the test coverage to ensure more thorough testing of edge cases and potential failure points in the feature conversion process.

Key Changes:

  1. Enhancement of features_to_image_shapes:

    • Updated the function to skip invalid features instead of raising a ValueError. This allows the processing of mixed datasets, where valid features can still be converted even if some are malformed or unsupported.
    • Added logging to inform users when a feature is skipped due to errors, improving traceability and debugging.
  2. New and Updated Unit Tests:

    • Refactored test_features_conversion_no_geometry and test_features_conversion_unsupported_type:
      • Adjusted these tests to align with the new behavior of features_to_image_shapes. They now verify that invalid features are skipped, rather than expecting exceptions.
    • Improved test_features_conversion_mixed:
      • Verified that only valid features are processed, ensuring that the function can handle datasets with a mix of valid and invalid inputs.
      • Enhanced with additional logging to aid in debugging.
    • New Test for Basic Valid Feature Conversion:
      • Added test_features_conversion_basic_point to confirm that simple, valid features are correctly processed and converted.
    • New Test for convert_nested_coordinate_lists:
      • Ensured the function behaves correctly when handling single vs. nested coordinates.
      • Validated that the conversion function handles input as expected without altering valid data.
    • Additional Debugging Tests:
      • Added more logging within the features_to_image_shapes function to trace feature processing, helping to identify why valid features might be skipped.
  3. Improved Error Handling:

    • The function now uses try-except blocks to catch and log errors during feature processing. Invalid features are logged and skipped, instead of halting the entire process.

Checklist

Before you submit a pull request, please make sure you have the following:

  • Code changes are compact and well-structured to facilitate easy review
  • Changes are documented in the README.md and other relevant documentation pages
  • PR title and description accurately reflect the changes and are detailed enough for historical tracking
  • PR contains tests that cover all new code and the code has been manual tested
  • All new dependencies are declared (if any), and no unnecessary libraries are added
  • Performance impacts (if any) of the changes are evaluated and documented
  • Security implications of the changes (if any) are reviewed and addressed
  • I have read the Contributing Guidelines and agree to follow the Code of Conduct

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@drduhe drduhe force-pushed the fix/increase-feature-util-coverage branch from 725f376 to b28ea50 Compare October 23, 2024 22:26
@drduhe drduhe merged commit eacaecd into main Oct 24, 2024
2 checks passed
@drduhe drduhe deleted the fix/increase-feature-util-coverage branch October 24, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants